package com.net.xpay.common.manager.impl;

import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.net.common.dao.BasicMapper;
import com.net.xpay.common.dao.AlipayUserSignAuthRecordMapper;
import com.net.xpay.common.domain.AlipayUserSignAuthRecord;
import com.net.xpay.common.manager.AlipayUserSignAuthRecordManager;
import com.net.common.manager.AbstractManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Component
public class AlipayUserSignAuthRecordManagerImpl extends AbstractManager<AlipayUserSignAuthRecord> implements AlipayUserSignAuthRecordManager{

    @Autowired
    private AlipayUserSignAuthRecordMapper mapper;


    @Override
    protected BasicMapper<Long, AlipayUserSignAuthRecord> getMapper() {
        return mapper;
    }

    @Override
    public AlipayUserSignAuthRecord findByAlipayNickName(Long userId, String alipayNickName) {
        Preconditions.checkArgument(userId != null && !Strings.isNullOrEmpty(alipayNickName));
        AlipayUserSignAuthRecord condition = new AlipayUserSignAuthRecord();
        condition.setUserId(userId);
        condition.setAlipayNickName(alipayNickName);
        return getByCondition(condition);
    }

    @Override
    public AlipayUserSignAuthRecord getByBizNo(String bizNo) {
        Preconditions.checkArgument(!Strings.isNullOrEmpty(bizNo));
        AlipayUserSignAuthRecord condition = new AlipayUserSignAuthRecord();
        condition.setBizNo(bizNo);
        return getByCondition(condition);
    }
}
